package com;

import com.lz.config.SpringConfig;
import com.lz.dao.Brandsdao;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

import java.util.HashMap;

/**
 * @Author 小思
 * @Description //TODO
 * @Date $ $
 * @Param $
 * @return $
 **/
//@Slf4j
//    select *from tb_brand where status = 1
//    and brand_name LIKE '%小米%' and company_name like '%小米%'
public class SpringMbTest {
    public static void main(String[] args) {
        //接收参数
        Integer status = null;


        String companyName = "%小米ss%";
        String brandName = null;
        //处理参数
         /*       String companyName = "%" + "小米" + "%";
        String brandName = "%" + "小米" + "%";*/
       /* PlusBrand brand = new PlusBrand();
        brand.setStatus(status);
        brand.setCompanyName(companyName);
        brand.setBrandName(brandName);*/
        HashMap map = new HashMap<>();
//        map.put("companyName", companyName);
        map.put("brandName", brandName);
//        map.put("status", status);
//
        AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(SpringConfig.class);
        Brandsdao bean = ctx.getBean(Brandsdao.class);
        //查看详情
//        System.out.println(bean.selectById(id));
        //查看所有
//        System.out.println(bean.findAll());
//        按条件查询
//        System.out.println(bean.selectCondition(status, brandName, companyName));
//        System.out.println(bean.selectConditionxml(map));
        //条件查询 条件动态
//        System.out.println(bean.selectByConditionPlusxml(map));
        bean.selectByConditionPlusxml(status, brandName, companyName);


    }
}
